.class public Lcom/instagram/creation/base/ui/FilterPicker;
.super Landroid/widget/HorizontalScrollView;
.source "FilterPicker.java"

# interfaces
.implements Lcom/instagram/creation/base/ui/l;


# instance fields
.field private a:Lcom/instagram/creation/base/ui/h;

.field private b:I

.field private c:Lcom/instagram/creation/base/ui/b;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1
    .parameter "context"

    .prologue
    .line 32
    invoke-direct {p0, p1}, Landroid/widget/HorizontalScrollView;-><init>(Landroid/content/Context;)V

    .line 28
    const/4 v0, -0x1

    iput v0, p0, Lcom/instagram/creation/base/ui/FilterPicker;->b:I

    .line 33
    invoke-virtual {p0}, Lcom/instagram/creation/base/ui/FilterPicker;->a()V

    .line 34
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 37
    invoke-direct {p0, p1, p2}, Landroid/widget/HorizontalScrollView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 28
    const/4 v0, -0x1

    iput v0, p0, Lcom/instagram/creation/base/ui/FilterPicker;->b:I

    .line 38
    invoke-virtual {p0}, Lcom/instagram/creation/base/ui/FilterPicker;->a()V

    .line 39
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 1
    .parameter "context"
    .parameter "attrs"
    .parameter "defStyle"

    .prologue
    .line 42
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/HorizontalScrollView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 28
    const/4 v0, -0x1

    iput v0, p0, Lcom/instagram/creation/base/ui/FilterPicker;->b:I

    .line 43
    invoke-virtual {p0}, Lcom/instagram/creation/base/ui/FilterPicker;->a()V

    .line 44
    return-void
.end method

.method private a(Lcom/instagram/creation/base/ui/h;[Lcom/instagram/creation/base/f;)V
    .locals 4
    .parameter
    .parameter

    .prologue
    .line 99
    const/4 v0, 0x0

    :goto_0
    array-length v1, p2

    if-ge v0, v1, :cond_0

    .line 100
    new-instance v1, Lcom/instagram/creation/base/ui/FilterTileButton;

    invoke-virtual {p1}, Lcom/instagram/creation/base/ui/h;->getContext()Landroid/content/Context;

    move-result-object v2

    aget-object v3, p2, v0

    invoke-direct {v1, v2, v3}, Lcom/instagram/creation/base/ui/FilterTileButton;-><init>(Landroid/content/Context;Lcom/instagram/creation/base/f;)V

    .line 101
    invoke-virtual {v1, v0}, Lcom/instagram/creation/base/ui/FilterTileButton;->setId(I)V

    .line 102
    invoke-virtual {p1, v1}, Lcom/instagram/creation/base/ui/h;->addView(Landroid/view/View;)V

    .line 99
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 104
    :cond_0
    return-void
.end method

.method private setRestoreScrollPosition(I)V
    .locals 0
    .parameter "scrollX"

    .prologue
    .line 150
    iput p1, p0, Lcom/instagram/creation/base/ui/FilterPicker;->b:I

    .line 151
    return-void
.end method


# virtual methods
.method public a()V
    .locals 2

    .prologue
    const/4 v1, 0x0

    .line 73
    sget v0, Lcom/facebook/av;->cover_bg_tile:I

    invoke-virtual {p0, v0}, Lcom/instagram/creation/base/ui/FilterPicker;->setBackgroundResource(I)V

    .line 75
    invoke-virtual {p0, v1}, Lcom/instagram/creation/base/ui/FilterPicker;->setHorizontalFadingEdgeEnabled(Z)V

    .line 76
    invoke-virtual {p0, v1}, Lcom/instagram/creation/base/ui/FilterPicker;->setHorizontalScrollBarEnabled(Z)V

    .line 77
    return-void
.end method

.method public a(Lcom/instagram/creation/base/ui/h;I)V
    .locals 5
    .parameter
    .parameter

    .prologue
    const/4 v4, 0x0

    .line 108
    invoke-virtual {p1}, Lcom/instagram/creation/base/ui/h;->getCheckedRadioButtonId()I

    move-result v0

    invoke-virtual {p1, v0}, Lcom/instagram/creation/base/ui/h;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Lcom/instagram/creation/base/ui/FilterTileButton;

    .line 111
    iget-object v1, p0, Lcom/instagram/creation/base/ui/FilterPicker;->c:Lcom/instagram/creation/base/ui/b;

    if-eqz v1, :cond_0

    .line 112
    iget-object v1, p0, Lcom/instagram/creation/base/ui/FilterPicker;->c:Lcom/instagram/creation/base/ui/b;

    invoke-virtual {v0}, Lcom/instagram/creation/base/ui/FilterTileButton;->getFilter()Lcom/instagram/creation/base/f;

    move-result-object v2

    invoke-virtual {p1}, Lcom/instagram/creation/base/ui/h;->getCheckedRadioButtonId()I

    move-result v3

    invoke-interface {v1, v2, v3}, Lcom/instagram/creation/base/ui/b;->a(Lcom/instagram/creation/base/f;I)V

    .line 116
    :cond_0
    invoke-virtual {v0}, Lcom/instagram/creation/base/ui/FilterTileButton;->getLeft()I

    move-result v1

    invoke-virtual {v0}, Lcom/instagram/creation/base/ui/FilterTileButton;->getWidth()I

    move-result v2

    sub-int/2addr v1, v2

    invoke-virtual {p0}, Lcom/instagram/creation/base/ui/FilterPicker;->getScrollX()I

    move-result v2

    sub-int/2addr v1, v2

    .line 118
    invoke-virtual {v0}, Lcom/instagram/creation/base/ui/FilterTileButton;->getRight()I

    move-result v2

    invoke-virtual {v0}, Lcom/instagram/creation/base/ui/FilterTileButton;->getWidth()I

    move-result v0

    add-int/2addr v0, v2

    invoke-virtual {p0}, Lcom/instagram/creation/base/ui/FilterPicker;->getWidth()I

    move-result v2

    sub-int/2addr v0, v2

    invoke-virtual {p0}, Lcom/instagram/creation/base/ui/FilterPicker;->getScrollX()I

    move-result v2

    sub-int/2addr v0, v2

    .line 121
    if-lez v0, :cond_2

    .line 122
    invoke-virtual {p0, v0, v4}, Lcom/instagram/creation/base/ui/FilterPicker;->smoothScrollBy(II)V

    .line 126
    :cond_1
    :goto_0
    return-void

    .line 123
    :cond_2
    if-gez v1, :cond_1

    .line 124
    invoke-virtual {p0, v1, v4}, Lcom/instagram/creation/base/ui/FilterPicker;->smoothScrollBy(II)V

    goto :goto_0
.end method

.method public getSelectedFilter()Lcom/instagram/creation/base/f;
    .locals 2

    .prologue
    .line 67
    iget-object v0, p0, Lcom/instagram/creation/base/ui/FilterPicker;->a:Lcom/instagram/creation/base/ui/h;

    iget-object v1, p0, Lcom/instagram/creation/base/ui/FilterPicker;->a:Lcom/instagram/creation/base/ui/h;

    invoke-virtual {v1}, Lcom/instagram/creation/base/ui/h;->getCheckedRadioButtonId()I

    move-result v1

    invoke-virtual {v0, v1}, Lcom/instagram/creation/base/ui/h;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Lcom/instagram/creation/base/ui/FilterTileButton;

    .line 69
    invoke-virtual {v0}, Lcom/instagram/creation/base/ui/FilterTileButton;->getFilter()Lcom/instagram/creation/base/f;

    move-result-object v0

    return-object v0
.end method

.method protected onMeasure(II)V
    .locals 2
    .parameter "widthMeasureSpec"
    .parameter "heightMeasureSpec"

    .prologue
    const/4 v1, -0x1

    .line 48
    invoke-super {p0, p1, p2}, Landroid/widget/HorizontalScrollView;->onMeasure(II)V

    .line 50
    iget v0, p0, Lcom/instagram/creation/base/ui/FilterPicker;->b:I

    if-eq v0, v1, :cond_0

    .line 51
    iget v0, p0, Lcom/instagram/creation/base/ui/FilterPicker;->b:I

    .line 52
    iput v1, p0, Lcom/instagram/creation/base/ui/FilterPicker;->b:I

    .line 53
    new-instance v1, Lcom/instagram/creation/base/ui/a;

    invoke-direct {v1, p0, v0}, Lcom/instagram/creation/base/ui/a;-><init>(Lcom/instagram/creation/base/ui/FilterPicker;I)V

    invoke-virtual {p0, v1}, Lcom/instagram/creation/base/ui/FilterPicker;->post(Ljava/lang/Runnable;)Z

    .line 60
    :cond_0
    return-void
.end method

.method public onRestoreInstanceState(Landroid/os/Parcelable;)V
    .locals 2
    .parameter "state"

    .prologue
    .line 138
    invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v0

    const-class v1, Lcom/instagram/creation/base/ui/FilterPicker$SavedState;

    invoke-virtual {v0, v1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_0

    .line 140
    invoke-super {p0, p1}, Landroid/widget/HorizontalScrollView;->onRestoreInstanceState(Landroid/os/Parcelable;)V

    .line 147
    .end local p1
    :goto_0
    return-void

    .line 144
    .restart local p1
    :cond_0
    check-cast p1, Lcom/instagram/creation/base/ui/FilterPicker$SavedState;

    .line 145
    .end local p1
    invoke-virtual {p1}, Lcom/instagram/creation/base/ui/FilterPicker$SavedState;->getSuperState()Landroid/os/Parcelable;

    move-result-object v0

    invoke-super {p0, v0}, Landroid/widget/HorizontalScrollView;->onRestoreInstanceState(Landroid/os/Parcelable;)V

    .line 146
    iget v0, p1, Lcom/instagram/creation/base/ui/FilterPicker$SavedState;->a:I

    invoke-direct {p0, v0}, Lcom/instagram/creation/base/ui/FilterPicker;->setRestoreScrollPosition(I)V

    goto :goto_0
.end method

.method public onSaveInstanceState()Landroid/os/Parcelable;
    .locals 2

    .prologue
    .line 130
    invoke-super {p0}, Landroid/widget/HorizontalScrollView;->onSaveInstanceState()Landroid/os/Parcelable;

    move-result-object v0

    .line 131
    new-instance v1, Lcom/instagram/creation/base/ui/FilterPicker$SavedState;

    invoke-direct {v1, v0}, Lcom/instagram/creation/base/ui/FilterPicker$SavedState;-><init>(Landroid/os/Parcelable;)V

    .line 132
    invoke-virtual {p0}, Lcom/instagram/creation/base/ui/FilterPicker;->getScrollX()I

    move-result v0

    iput v0, v1, Lcom/instagram/creation/base/ui/FilterPicker$SavedState;->a:I

    .line 133
    return-object v1
.end method

.method public setFilters([Lcom/instagram/creation/base/f;)V
    .locals 3
    .parameter "filters"

    .prologue
    .line 80
    new-instance v0, Lcom/instagram/creation/base/ui/h;

    invoke-virtual {p0}, Lcom/instagram/creation/base/ui/FilterPicker;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Lcom/instagram/creation/base/ui/h;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/instagram/creation/base/ui/FilterPicker;->a:Lcom/instagram/creation/base/ui/h;

    .line 81
    iget-object v0, p0, Lcom/instagram/creation/base/ui/FilterPicker;->a:Lcom/instagram/creation/base/ui/h;

    sget v1, Lcom/facebook/aw;->filter_tile_group:I

    invoke-virtual {v0, v1}, Lcom/instagram/creation/base/ui/h;->setId(I)V

    .line 82
    iget-object v0, p0, Lcom/instagram/creation/base/ui/FilterPicker;->a:Lcom/instagram/creation/base/ui/h;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Lcom/instagram/creation/base/ui/h;->setOrientation(I)V

    .line 83
    iget-object v0, p0, Lcom/instagram/creation/base/ui/FilterPicker;->a:Lcom/instagram/creation/base/ui/h;

    invoke-virtual {v0, p0}, Lcom/instagram/creation/base/ui/h;->setOnCheckedChangeListener(Lcom/instagram/creation/base/ui/l;)V

    .line 85
    new-instance v0, Landroid/widget/LinearLayout$LayoutParams;

    const/4 v1, -0x2

    const/4 v2, -0x1

    invoke-direct {v0, v1, v2}, Landroid/widget/LinearLayout$LayoutParams;-><init>(II)V

    .line 88
    iget-object v1, p0, Lcom/instagram/creation/base/ui/FilterPicker;->a:Lcom/instagram/creation/base/ui/h;

    invoke-virtual {v1, v0}, Lcom/instagram/creation/base/ui/h;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 89
    iget-object v0, p0, Lcom/instagram/creation/base/ui/FilterPicker;->a:Lcom/instagram/creation/base/ui/h;

    invoke-direct {p0, v0, p1}, Lcom/instagram/creation/base/ui/FilterPicker;->a(Lcom/instagram/creation/base/ui/h;[Lcom/instagram/creation/base/f;)V

    .line 91
    iget-object v0, p0, Lcom/instagram/creation/base/ui/FilterPicker;->a:Lcom/instagram/creation/base/ui/h;

    invoke-virtual {p0, v0}, Lcom/instagram/creation/base/ui/FilterPicker;->addView(Landroid/view/View;)V

    .line 92
    return-void
.end method

.method public setOnFilterChangedListener(Lcom/instagram/creation/base/ui/b;)V
    .locals 0
    .parameter "listener"

    .prologue
    .line 63
    iput-object p1, p0, Lcom/instagram/creation/base/ui/FilterPicker;->c:Lcom/instagram/creation/base/ui/b;

    .line 64
    return-void
.end method

.method public setSelectedFilterIndex(I)V
    .locals 2
    .parameter "i"

    .prologue
    .line 95
    iget-object v0, p0, Lcom/instagram/creation/base/ui/FilterPicker;->a:Lcom/instagram/creation/base/ui/h;

    invoke-virtual {v0, p1}, Lcom/instagram/creation/base/ui/h;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Lcom/instagram/creation/base/ui/FilterTileButton;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Lcom/instagram/creation/base/ui/FilterTileButton;->setChecked(Z)V

    .line 96
    return-void
.end method
